/**
 * 
 */
package name.webdizz.gadget.four.envelope.client.view;

import java.util.List;

import name.webdizz.gadget.four.envelope.client.domain.ExpenseItem;
import name.webdizz.gadget.four.envelope.client.domain.Goal;
import name.webdizz.gadget.four.envelope.client.event.CreditExpenseEventHandler;
import name.webdizz.gadget.four.envelope.client.event.CreditGoalEventHandler;
import name.webdizz.gadget.four.envelope.client.view.widgets.ExpenseListUi;

/**
 * @author Izzet_Mustafayev
 * 
 */
public class EnvelopeViewHelper {

	public static void createExpenseListItem(
			final ExpenseListUi expenseListPanel,
			final List<ExpenseItem> items, final String title,
			final CreditGoalEventHandler creditGoal) {
		if (null != items) {
			expenseListPanel.addItemsTitle(title);
			for (ExpenseItem item : items) {
				expenseListPanel.addItem((Goal) item, creditGoal);
			}
		}
	}

	public static void createExpenseListItem(
			final ExpenseListUi expenseListPanel,
			final List<ExpenseItem> items, final String title,
			final CreditExpenseEventHandler creditExpenseHandler) {
		if (null != items) {
			expenseListPanel.addItemsTitle(title);
			for (ExpenseItem item : items) {
				expenseListPanel.addItem(item, creditExpenseHandler);
			}
		}
	}
}
